/**
 * @param {number[][]} envelopes
 * @return {number}
 */
 var maxEnvelopes = function(envelopes) {
  const len = envelopes.length
  let res = new Array(len).fill(1).map(()=>[1,0]),count =0
  for(let i=0;i<len;i++){
    let minRow=0,minCol=0,index
    for(let j=0;j<len;j++){
      if(j!=i){
        if(envelopes[i][0]<envelopes[j][0]&& envelopes[i][1]<envelopes[j][1]){
          minRow =Math.min(minRow,envelopes[j][0])
        }
      }
    }
  }

  for(let i=0;i<len;i++){
    count = Math.max(res[i][0]+res[i][1],count)
  }

  return count
};

maxEnvelopes([[5,4],[6,4],[6,7],[2,3]])